<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page isELIgnored="false" %><%--启动EL表达式解析--%>
<%
    request.setCharacterEncoding("UTF-8");
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
    <base href="<%=basePath%>">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>新增商品</title>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>/bootstrap/css/bootstrap.min.css">
    <!-- href：里面的路径是你导入在static文件夹里面下面bootstrap.min.css所在的路径，下面两个属性一样 -->
    <script type="text/javascript" src="<%=basePath%>/jquery/jquery-3.6.0.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/bootstrap/js/bootstrap.min.js"></script>
</head>
<body class="panel-body">
    <div class="container-fluid">
        <form class="form-horizontal" action="<%=basePath%>pages/back/admin/add" method="post" enctype="multipart/form-data">
            <div class="form-group" id="nameDiv">
                <%--@declare id="name"--%>
                <label class="col-md-2 control-label" for="name">商品名称:</label>
                <div class="col-md-5">
                    <input type="text" class="form-control" id="name" name="name" placeholder="请填写商品名称">
                </div>
                <span class="col-md-5" id="nameSpan">*</span>
            </div>
            <div class="form-group" id="priceDiv">
                <%--@declare id="price"--%>
                <label class="col-md-2 control-label" for="price">商品价格:</label>
                <div class="col-md-5">
                    <input type="text" class="form-control" id="price" name="price" placeholder="请填写商品单价">
                </div>
                <span class="col-md-5" id="priceSpan">*</span>
            </div>
            <div class="form-group" id="iidDiv">
                <%--@declare id="iid"--%>
                <label class="col-md-2 control-label" for="iid">商品分类:</label>
                <div class="col-md-5">
                    <select id="iid" name="iid" class="form-control">
                        <option value="">**请选择商品所属分类**</option>
                        <c:forEach items="${allItems}" var="item">
                            <option value="${item.iid}">${item.title}</option>
                        </c:forEach>
                    </select>
                </div>
                <span class="col-md-5" id="iidSpan">*</span>
            </div>
            <div class="form-group" id="tagDiv">
                <%--@declare id="tag"--%>
                <label class="col-md-2 control-label" for="tag">商品标签:</label>
                <div class="col-md-5">
                    <c:forEach items="${allTags}" var="tag">
                        <div class="col-md-3">
                            <div class="checkbox">
                                <label><input type="checkbox" id="tid" name="tid"
                                              value="${tag.tid}"/>${tag.title}</label>
                            </div>
                        </div>
                    </c:forEach>
                </div>
                <span class="col-md-5" id="tidSpan">*</span>
            </div>
            <div class="form-group" id="picDiv">
                <%--@declare id="pic"--%>
                <label class="col-md-2 control-label" for="pic">商品图片:</label>
                <div class="col-md-5">
                    <input type="file" class="form-control" id="pic" name="pic">
                </div>
                <span class="col-md-5" id="priceSpan">*</span>
            </div>
            <div class="form-group">
                <div class="col-md-offset-3">
                    <button type="submit" class="btn btn-primary">提交</button>
                    <button type="reset" class="btn btn-default">重置</button>
                </div>
            </div>
        </form>
    </div>
</body>
</html>
